using SqlSugar;
using System;

namespace B.S.XZYData.Domain.LJC
{
    /// <summary>
    /// 工单报工关联表
    /// </summary>
    [SugarTable("wo_rpt_rel")]
    public class WorkOrderReportRelationModel
    {
        /// <summary>
        /// 主键 ID
        /// </summary>
        [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        /// <summary>
        /// 工单ID
        /// </summary>
        [SugarColumn(ColumnName = "wo_id", IsNullable = false)]
        public int WorkOrderId { get; set; }

        /// <summary>
        /// 报工ID
        /// </summary>
        [SugarColumn(ColumnName = "rpt_id", IsNullable = false)]
        public int WorkReportId { get; set; }

        /// <summary>
        /// 关联关系类型（可选字段，用于区分不同类型的关联）
        /// </summary>
        [SugarColumn(ColumnName = "relation_type", Length = 20, IsNullable = true)]
        public string? RelationType { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [SugarColumn(ColumnName = "remark", Length = 500, IsNullable = true)]
        public string? Remark { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnName = "create_time", IsNullable = false)]
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 创建人
        /// </summary>
        [SugarColumn(ColumnName = "create_by", Length = 50, IsNullable = true)]
        public string? CreateBy { get; set; }

        /// <summary>
        /// 修改人
        /// </summary>
        [SugarColumn(ColumnName = "update_by", Length = 50, IsNullable = true)]
        public string? UpdateBy { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        [SugarColumn(ColumnName = "update_time", IsNullable = true)]
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        [SugarColumn(ColumnName = "is_deleted", IsNullable = false)]
        public bool IsDeleted { get; set; } = false;

        // 导航属性 - 不映射到数据库
        /// <summary>
        /// 关联的工单信息
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public WorkOrderModel? WorkOrder { get; set; }

        /// <summary>
        /// 关联的报工信息 (LJC.WorkOrderReportModel)
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public WorkOrderReportModel? WorkReport { get; set; }
    }
}
